<script type="text/javascript">
	function doSearchWxUserInfo(value) {
		
	}
	
	//表格查询  
	function reloadWxUserInfo() {
		var params = wxUserInfo_list.datagrid('options').queryParams; //先取得 datagrid 的查询参数  
		printLog(params);
		wxUserInfo_list.datagrid('reload'); //设置好查询参数 reload 一下就可以了  
		wxUserInfo_list.datagrid('unselectAll');
		wxUserInfo_list.datagrid('uncheckAll');
	}


	function addWxUserInfo() {
		createFromWindow("新增信息", "wxUserInfo.do?editWxUserInfo", "wxUserInfo.do?saveWxUserInfo",
				function(data) {
					reloadWxUserInfo();
				});
	}
	
	function deleteWxUserInfo() {
		var rows = wxUserInfo_list.datagrid('getChecked');
	    if (rows&&rows.length>0){
	        $.messager.confirm('询问','你确认要删除吗?',function(r){
	            if (r){
	            	var ids = "";
	            	for(var i=0; i<rows.length; i++){
	            		ids += rows[i].id+",";
	            	}
	                $.post('wxUserInfo.do?deleteWxUserInfoItems',{ids:ids},function(result){
	                    if (result.success){
	                    	reloadWxUserInfo();    
	                    }
	                    showMsg(result.msg);
	                },'json');
	            }
	        });
	    }else {
	    	showMsg("请选择操作记录.");
	    }
	}
	
	function resetWxUserInfo() {
		var rows = wxUserInfo_list.datagrid('getChecked');
	    if (rows&&rows.length>0){
	        $.messager.confirm('询问','你确认要重置清空签到信息吗?',function(r){
	            if (r){
	            	var ids = "";
	            	for(var i=0; i<rows.length; i++){
	            		ids += rows[i].id+",";
	            	}
	                $.post('wxUserInfo.do?resetWxUserInfoItems',{ids:ids},function(result){
	                    if (result.success){
	                    	reloadWxUserInfo();    
	                    }
	                    showMsg(result.msg);
	                },'json');
	            }
	        });
	    }else {
	    	showMsg("请选择操作记录.");
	    }
	}

	function editWxUserInfo() {
		var rows = wxUserInfo_list.datagrid('getChecked');
		printLog(rows);
		if (rows&&rows.length>0) {
			if(rows.length>1) {
				showMsg('请选择一条操作记录.');
				return;
			}
			createFromWindow("编辑信息", "wxUserInfo.do?editWxUserInfo&wxUserInfoId=" + rows[0].id,
					"wxUserInfo.do?saveWxUserInfo", function(data) {
						reloadWxUserInfo();
					},true);
		} else {
			showMsg('请选择操作记录.');
		}

	}
	
	
	function clearWxUserInfoSearch() {
		setGridSearchParams('wxUserInfo_list','wxUserInfoSearchForm',true,reloadWxUserInfo);
	}
	
	//根据条件查询
	function wxUserInfoSearch() {
		setGridSearchParams('wxUserInfo_list','wxUserInfoSearchForm',false,reloadWxUserInfo);
	}
	
	function onDblClickWxUserInfoRow(rowIndex, rowData) {
		createFromWindow("编辑信息", "wxUserInfo.do?editWxUserInfo&wxUserInfoId=" + rowData.id,
					"wxUserInfo.do?saveWxUserInfo", function(data) {
						reloadWxUserInfo();
					},true);
	}
	
	function importWxUser() {		
		createFromWindowOptions({
			title:"导入文件",
			maximizable:false,
			width:400,
			height:200,
			href:"wxUserInfo.do?importFile&actionUrl=wxUserInfo.do?import",
			callback:function(data) {
				$('#fileForm').ajaxSubmit({
					async : false,
					dataType : 'json',
					success : function(data) 
					{
						showMsg(data.msg);
						reloadWxUserInfo();
					},
					error : function(XMLHttpRequest, textStatus, errorThrown)
					{
						printLog('error');
						showMsg('请求处理错误');
					}
				});
			},
			enableSaveButton:true
		});
	}
	
	function exportWxUser() {
        downLoadFile("wxUserInfo.do?export");
	}
</script>


<div class="easyui-layout" data-options="fit:true">
	<div data-options="region:'center',border:false">
		<@eu.datagrid id="wxUserInfo_list" toolbar="#wxUserInfolist_search" idField="id"  url="wxUserInfo.do?loadList" rownumbers="true"
			 item="com.xdtech.wx.vo.WxUserInfoItem"/>
		
		<div id="wxUserInfolist_search">
			<div style="margin-bottom:5px;padding-left:5px;margin-top: 5px;">
				<form id="wxUserInfoSearchForm">
					<!-- 防止form表单里只有一个text元素时候，按enter键自动提交问题 -->
					<input style="display:none" />
					<table>
						<tr>
							<td class="tbLabel">姓名:</td>
			    			<td><input type="text" class="easyui-validatebox textbox" name="name" ></input></td>
			    			<td>是否签到:</td>
			    			<td>
			    				<@eu.comboBox url="common.do?loadComboBox&key=YES_OR_NO" name="signStatus"/>
			    			</td>
			    			<td>
								<@eu.linkbutton showName="查询" iconCls="icon-search" onclick="wxUserInfoSearch()"/>
	 					 		<@eu.linkbutton showName="清空" iconCls="icon-clear" onclick="clearWxUserInfoSearch()"/>
 					 		</td>
			    			
						</tr>
					</table>
				</form>
				
			</div>
			<div id="wxUserInfo_toolbar" style="height: auto">
<!-- 				<@eu.linkbutton showName="新增" shiro="wx:wxUserInfo:add" iconCls="icon-add" onclick="addWxUserInfo()"/> -->
				<@eu.linkbutton showName="删除" shiro="wx:wxUserInfo:delete" iconCls="icon-remove" onclick="deleteWxUserInfo()"/>
<!-- 				<@eu.linkbutton showName="编辑" shiro="wx:wxUserInfo:edit" iconCls="icon-edit" onclick="editWxUserInfo()"/> -->
				<@eu.linkbutton showName="刷新" shiro="wx:wxUserInfo:refresh" iconCls="icon-reload" onclick="reloadWxUserInfo()"/>
				<@eu.linkbutton showName="重置" shiro="wx:wxUserInfo:reset" iconCls="icon-remove" onclick="resetWxUserInfo()"/>
				<@eu.linkbutton showName="导入" shiro="wx:wxUserInfo:import" iconCls="icon-import" onclick="importWxUser()"/>
				<@eu.linkbutton showName="导出" shiro="wx:wxUserInfo:export" iconCls="icon-export" onclick="exportWxUser()"/>
			</div>
		</div>
	</div>
</div>